<template>
<!-- 评价 -->
  <div class="pingjia">
      <div class="p_head">商品评论</div>
      <div v-if="pingjialist.length!=0">
          <div class="ping_wrap">
              <div class="ping_one">
                  <div>
                      <img :src="pingjialist.userhead" alt="">
                      <p>{{pingjialist.nickname}}</p>
                  </div>
                  <div>
                      <p>{{pingjialist.evaluate.first.user_evaluate}}</p>
                      <p>{{pingjialist.evaluate.first.user_time}}</p>
                  </div>
              </div>
          </div>
      </div>
      <div class="nopingjia" v-if="pingjialist.length==0">暂无数据</div>
  </div>
</template>

<script>
import {getGoodsEvaluate} from '../../../api/info'
// import {Toast} from 'vant'
export default {
    name:'evaluate',
    props:['gid'],
    data() {
        return {
            pingjialist:[],
            // failmsg:''
        }
    },
    methods: {
        getGoodsEvaluatelist(){
            getGoodsEvaluate({gid:this.gid,p:1}).then(res=>{
                // console.log("商品评论--",res)
                if(res.msg == "暂无数据"){
                    // Toast.fail("暂无评论")
                    let failmsg = "暂无评论"
                    this.$emit('send-data',failmsg)
                }else{
                    this.pingjialist = res.result.data
                }
            })
        }
    },
    created() {
        this.getGoodsEvaluatelist()
    },
}
</script>

<style lang="less">
.pingjia{
    width: 100%;
    background-color: white;
    padding: 50px 0;
    margin: 20px 0;
    border-radius: 40px;
}
    .p_head{
         height: 80px;
        line-height: 40px;
        font-size: 60px;
        font-weight: bold;
    }
    .nopingjia{
        width: 100%;
        height: 60px;
        line-height: 60px;
        font-size: 40px;
        padding-bottom: 300px;
    }
</style>